package com.ziven.learn;

import com.ziven.easygo.util.Conditions;
import com.ziven.easygo.util.EasyUtils;
import com.ziven.easygo.util.LogHelper;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author Ziven
 */
public interface LearnInterface2 extends LearnInterface {

    AtomicInteger COUNT = new AtomicInteger(0);

    /**
     * Learn
     */
    @Override
    default void learn() {
        int i = COUNT.incrementAndGet();
        EasyUtils.conditions(new Conditions() {
            @Override
            public void condition(int condition) {
                LogHelper.of("LearnInterface2").join("condition:").join(i).print();
                learn(i);
            }

            @Override
            public void condition1() {
                LogHelper.of("LearnInterface2").join("condition1:").join(i).print();
                learn1();
            }

            @Override
            public void condition2() {
                LogHelper.of("LearnInterface2").join("condition2:").join(i).print();
                learn2();
            }

            @Override
            public void condition3() {
                LogHelper.of("LearnInterface2").join("condition3:").join(i).print();
                learn3();
            }

            @Override
            public void condition4() {
                LogHelper.of("LearnInterface2").join("condition4:").join(i).print();
                learn4();
            }

            @Override
            public void condition5() {
                LogHelper.of("LearnInterface2").join("condition5:").join(i).print();
                learn5();
            }

            @Override
            public void condition6() {
                LogHelper.of("LearnInterface2").join("condition6:").join(i).print();
                learn6();
            }

            @Override
            public void condition7() {
                LogHelper.of("LearnInterface2").join("condition7:").join(i).print();
                learn7();
            }

            @Override
            public void condition8() {
                LogHelper.of("LearnInterface2").join("condition8:").join(i).print();
                learn8();
            }

            @Override
            public void condition9() {
                LogHelper.of("LearnInterface2").join("condition9:").join(i).print();
                learn9();
            }

            @Override
            public void other() {
                LogHelper.of("LearnInterface2").join("other:").join(i).print();
                learnOther(i);
            }
        }, i - 1);
    }

    /**
     * Learn
     * @param count Count
     */
    default void learn(int count) {}

    /**
     * Learn count == 1
     */
    void learn1();

    /**
     * Learn count == 2
     */
    default void learn2() {}

    /**
     * Learn count == 3
     */
    default void learn3() {}

    /**
     * Learn count == 4
     */
    default void learn4() {}

    /**
     * Learn count == 5
     */
    default void learn5() {}

    /**
     * Learn count == 6
     */
    default void learn6() {}

    /**
     * Learn count == 7
     */
    default void learn7() {}

    /**
     * Learn count == 8
     */
    default void learn8() {}

    /**
     * Learn count == 9
     */
    default void learn9() {}

    /**
     * Learn count > 9
     * @param count Count
     */
    default void learnOther(int count) {}

}
